package com.es.spring_es.Controller;

import com.es.spring_es.model.params.ReturnParams;
import com.es.spring_es.model.params.TridParams;
import com.es.spring_es.services.EsServices;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xu
 * @date 2020/6/3
 * @desciption 对外Controller
 */
@RestController
@RequestMapping("/es")
public class EsController {

    @Autowired
    EsServices esServices;

    @ApiOperation(value = "上传高德轨迹", notes = "", httpMethod = "POST")
    @PostMapping("/uploadDriverLocation")
    public ReturnParams uploadDriverLocation(@RequestBody TridParams request) {
        return esServices.uploadDriverLocation(request.getTid(),request.getTrid());
    }


    @ApiOperation(value = "获取高德轨迹列表", notes = "", httpMethod = "POST")
    @PostMapping("/getDriverLocationList")
    public ReturnParams getDriverLocationList(@RequestBody TridParams request) {
        return esServices.getDriverLocationList(request.getTid(),request.getTrid());
    }


    @ApiOperation(value = "获取高德轨迹列表", notes = "", httpMethod = "POST")
    @PostMapping("/test")
    public ReturnParams test(@RequestBody TridParams request) {
        return esServices.getDriverLocationList(request.getTid(),request.getTrid());
    }


}
